# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=stylua
pkgver=0.20.0
pkgrel=0
pkgdesc="Opinionated Lua code formatter"
url="https://github.com/JohnnyMorganz/StyLua"
arch="all"
license="MPL-2.0"
makedepends="cargo cargo-auditable"
source="$pkgname-$pkgver.tar.gz::https://github.com/JohnnyMorganz/StyLua/archive/refs/tags/v$pkgver.tar.gz"
builddir="$srcdir/StyLua-$pkgver"

_features="--no-default-features --features lua54,strum,serialize"

prepare() {
	default_prepare
	cargo fetch --target="$CTARGET" --locked
}

build() {
	cargo auditable build --release --frozen $_features
}

check() {
	cargo test --frozen $_features
}

package() {
	install -Dm755 target/release/stylua -t "$pkgdir"/usr/bin/
}

sha512sums="
0f15e169953eb96f846d864be7e35fb04be61c6951a4ba9967e26d5738807bfe110e9ba0e5d788a27b77d3c32f6df416d046f4a8c2139195004a8ecdbac504c7  stylua-0.20.0.tar.gz
"
